load("//tools/build_defs/android:fb_xplat_android_cxx_library.bzl", "fb_xplat_android_cxx_library")
load("//tools/build_defs/oss:profilo_defs.bzl", "profilo_path")

fb_xplat_android_cxx_library(
    name = "logger",
    srcs = [
        "Logger.cpp",
        "PacketLogger.cpp",
    ],
    header_namespace = "profilo",
    exported_headers = [
        "Logger.h",
        "PacketLogger.h",
    ],
    compiler_flags = [
        "-fexceptions",
        "-frtti",
        "-std=gnu++14",
        "-O3",
        "-DLOG_TAG=\"Profilo\"",
    ],
    labels = [],
    soname = "libprofilo_logger.$(ext)",
    tests = [
        profilo_path("cpp/test:packet_logger"),
    ],
    visibility = [
        profilo_path("..."),
    ],
    deps = [
        profilo_path("cpp:constants"),
        profilo_path("cpp/generated:cpp"),
        profilo_path("cpp/logger/buffer:trace_buffer"),
        profilo_path("cpp/util:util"),
        profilo_path("deps/fb:fb"),
        profilo_path("deps/linker:locks"),
    ],
)

fb_xplat_android_cxx_library(
    name = "multi_buffer_logger",
    srcs = [
        "MultiBufferLogger.cpp",
    ],
    header_namespace = "profilo",
    exported_headers = [
        "MultiBufferLogger.h",
    ],
    compiler_flags = [
        "-fexceptions",
        "-frtti",
        "-std=gnu++14",
        "-DLOG_TAG=\"Profilo\"",
    ],
    labels = [],
    soname = "libprofilo_multi_buffer_logger.$(ext)",
    tests = [
        profilo_path("cpp/test/logger:multi_buffer_logger_test"),
    ],
    visibility = [
        profilo_path("..."),
    ],
    deps = [
        profilo_path("deps/linker:locks"),
    ],
    exported_deps = [
        profilo_path("cpp/mmapbuf:buffer"),
    ],
)

fb_xplat_android_cxx_library(
    name = "block_logger",
    srcs = [
        "BlockLogger.cpp",
    ],
    header_namespace = "profilo/logger",
    exported_headers = [
        "BlockLogger.h",
    ],
    compiler_flags = [
        "-fexceptions",
        "-frtti",
        "-std=gnu++14",
        "-DLOG_TAG=\"Profilo\"",
    ],
    labels = [],
    preferred_linkage = "static",
    soname = "libprofilo_block_logger.$(ext)",
    tests = [
    ],
    visibility = [
        profilo_path("..."),
    ],
    exported_deps = [
        ":multi_buffer_logger",
    ],
)
